﻿#pragma execution_character_set("utf-8")
/*
 * 通信安全操作delegate
 */

#ifndef COMMUNICATESAVEDELEGATE_H
#define COMMUNICATESAVEDELEGATE_H
#include "communicatedelegate_global.h"
#include "../CommunicateDelegate/hmicommunicate.h"

class   CommunicateSaveDelegate : public QObject
{
    Q_OBJECT
public:
    CommunicateSaveDelegate();
    ~CommunicateSaveDelegate();
    int setUserInfo(UserInfo userInfoIn);

    HmiCommunicate *hmiCommunicate;

public:
    //用于临时缓存
    struct UserInfo tmpUserInfo;
    QString tmpServerIp;
    QByteArray tmpServerIpArray;

public slots:
    /**
     * @brief updateTmpInfo     登陆时 跟新用户数据
     */
    void updateTmpInfo(QString port);


    int stopRun();//停止运动槽
    int stopWatchDog();
    int pauseRunSlot();//暂停运动槽

    int runSlot();//运行按钮触发槽
    void setManualServonSlot(int onOff);//使能电机

    /**
     * @brief returnZeroSlot        回零
     * @param axisNum               回零的轴
     */
    int returnZeroSlot(int axisNum);

    /**
     * @brief returnZeroSlot        回零
     * @param axisNum               回零的轴
     */
    int returnZeroSlot();

    /**
     * @brief jogRunSlot            关节运动触发槽
     */
    void jogRunSlot(int axis,int direct);

    /**
     * @brief moveToPointSlot                       移动到点
     */
    void moveToPointSlot(MoveParameter movePoint);
    void setDragControl_slot(bool onOff);

    int jogRunDogSlot();

private:
    QMutex usingMutex;//避免多线程同时调用


};

#endif // COMMUNICATESAVEDELEGATE_H
